/* Transaction.h
Michael Zahniser

Header file for the Transaction class, which represents a transfer of money
between two accounts.
*/

#ifndef __FINE_TRANSACTION_H__
#define __FINE_TRANSACTION_H__

#include "Date.h"

#include <string>
#include <istream>
#include <ostream>

using std::string;
using std::istream;
using std::ostream;



class Transaction {
public:
    // Check whether this "transaction" is in fact an account modifier command.
    // Commands have 00000000 as their date.
    bool IsCommand() const;
    
    const Date &GetDate() const;
    void SetDate(const Date &date);
    const double GetAmount() const;
    void SetAmount(double amount);
    const string &GetFromAccount() const;
    void SetFromAccount(const string &from);
    const string &GetToAccount() const;
    void SetToAccount(const string &to);
    const string &GetComment() const;
    void SetComment(const string &comment);

    // Print the transaction in a form good for viewing.
    void PrettyPrint(ostream &out) const;
    friend istream &operator>>(istream &in, Transaction &transaction);
    friend ostream &operator<<(ostream &out, const Transaction &transaction);


private:
    Date date;
    double amount;
    string from;
    string to;
    string comment;
};

#endif
